\(\int \frac {\tan (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx\) [38]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 32, antiderivative size = 67 \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=-\frac {(i A-B) x}{2 a}+\frac {i B \log (\cos (c+d x))}{a d}-\frac {A+i B}{2 a d (1+i \tan (c+d x))} \]

[Out]

-1/2*(I*A-B)*x/a+I*B*ln(cos(d*x+c))/a/d+1/2*(-A-I*B)/a/d/(1+I*tan(d*x+c))

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.156, Rules used = {3670, 3556, 12, 3607, 8} \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=-\frac {A+i B}{2 a d (1+i \tan (c+d x))}-\frac {x (-B+i A)}{2 a}+\frac {i B \log (\cos (c+d x))}{a d} \]

[In]

Int[(Tan[c + d*x]*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x]),x]

[Out]

-1/2*((I*A - B)*x)/a + (I*B*Log[Cos[c + d*x]])/(a*d) - (A + I*B)/(2*a*d*(1 + I*Tan[c + d*x]))

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3607

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-(
b*c - a*d))*((a + b*Tan[e + f*x])^m/(2*a*f*m)), x] + Dist[(b*c + a*d)/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1
), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0]

Rule 3670

Int[(((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]))/((a_.) + (b_.)*tan[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Dist[B*(d/b), Int[Tan[e + f*x], x], x] + Dist[1/b, Int[Simp[A*b*c + (A*b*d + B*(
b*c - a*d))*Tan[e + f*x], x]/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a
*d, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {i \int \frac {a (i A-B) \tan (c+d x)}{a+i a \tan (c+d x)} \, dx}{a}-\frac {(i B) \int \tan (c+d x) \, dx}{a} \\ & = \frac {i B \log (\cos (c+d x))}{a d}-(-A-i B) \int \frac {\tan (c+d x)}{a+i a \tan (c+d x)} \, dx \\ & = \frac {i B \log (\cos (c+d x))}{a d}-\frac {A+i B}{2 d (a+i a \tan (c+d x))}-\frac {(i A-B) \int 1 \, dx}{2 a} \\ & = -\frac {(i A-B) x}{2 a}+\frac {i B \log (\cos (c+d x))}{a d}-\frac {A+i B}{2 d (a+i a \tan (c+d x))} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.50 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.12 \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {-((A+3 i B) \log (i-\tan (c+d x)))+(A-i B) \log (i+\tan (c+d x))+\frac {2 i (A+i B)}{-i+\tan (c+d x)}}{4 a d} \]

[In]

Integrate[(Tan[c + d*x]*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x]),x]

[Out]

(-((A + (3*I)*B)*Log[I - Tan[c + d*x]]) + (A - I*B)*Log[I + Tan[c + d*x]] + ((2*I)*(A + I*B))/(-I + Tan[c + d*
x]))/(4*a*d)

Maple [A] (verified)

Time = 0.06 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.28

method result size
risch \(\frac {3 x B}{2 a}-\frac {i x A}{2 a}-\frac {i {\mathrm e}^{-2 i \left (d x +c \right )} B}{4 a d}-\frac {{\mathrm e}^{-2 i \left (d x +c \right )} A}{4 a d}+\frac {2 B c}{a d}+\frac {i \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{a d}\) \(86\)
derivativedivides \(-\frac {i A \arctan \left (\tan \left (d x +c \right )\right )}{2 d a}-\frac {i B \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d a}+\frac {B \arctan \left (\tan \left (d x +c \right )\right )}{2 d a}+\frac {i A}{2 d a \left (\tan \left (d x +c \right )-i\right )}-\frac {B}{2 d a \left (\tan \left (d x +c \right )-i\right )}\) \(97\)
default \(-\frac {i A \arctan \left (\tan \left (d x +c \right )\right )}{2 d a}-\frac {i B \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d a}+\frac {B \arctan \left (\tan \left (d x +c \right )\right )}{2 d a}+\frac {i A}{2 d a \left (\tan \left (d x +c \right )-i\right )}-\frac {B}{2 d a \left (\tan \left (d x +c \right )-i\right )}\) \(97\)
norman \(\frac {\frac {\left (-i A +B \right ) x}{2 a}-\frac {i B +A}{2 a d}-\frac {\left (-i A +B \right ) \tan \left (d x +c \right )}{2 a d}+\frac {\left (-i A +B \right ) x \left (\tan ^{2}\left (d x +c \right )\right )}{2 a}}{1+\tan ^{2}\left (d x +c \right )}-\frac {i B \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d a}\) \(103\)

[In]

int(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

3/2*x/a*B-1/2*I*x/a*A-1/4*I/a/d*exp(-2*I*(d*x+c))*B-1/4/a/d*exp(-2*I*(d*x+c))*A+2/a/d*B*c+I*B/a/d*ln(exp(2*I*(
d*x+c))+1)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 66, normalized size of antiderivative = 0.99 \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=-\frac {{\left (2 \, {\left (i \, A - 3 \, B\right )} d x e^{\left (2 i \, d x + 2 i \, c\right )} - 4 i \, B e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + A + i \, B\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{4 \, a d} \]

[In]

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="fricas")

[Out]

-1/4*(2*(I*A - 3*B)*d*x*e^(2*I*d*x + 2*I*c) - 4*I*B*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) + A + I*B
)*e^(-2*I*d*x - 2*I*c)/(a*d)

Sympy [A] (verification not implemented)

Time = 0.22 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.78 \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {i B \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a d} + \begin {cases} \frac {\left (- A - i B\right ) e^{- 2 i c} e^{- 2 i d x}}{4 a d} & \text {for}\: a d e^{2 i c} \neq 0 \\x \left (- \frac {- i A + 3 B}{2 a} + \frac {\left (- i A e^{2 i c} + i A + 3 B e^{2 i c} - B\right ) e^{- 2 i c}}{2 a}\right ) & \text {otherwise} \end {cases} + \frac {x \left (- i A + 3 B\right )}{2 a} \]

[In]

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x)

[Out]

I*B*log(exp(2*I*d*x) + exp(-2*I*c))/(a*d) + Piecewise(((-A - I*B)*exp(-2*I*c)*exp(-2*I*d*x)/(4*a*d), Ne(a*d*ex
p(2*I*c), 0)), (x*(-(-I*A + 3*B)/(2*a) + (-I*A*exp(2*I*c) + I*A + 3*B*exp(2*I*c) - B)*exp(-2*I*c)/(2*a)), True
)) + x*(-I*A + 3*B)/(2*a)

Maxima [F(-2)]

Exception generated. \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\text {Exception raised: RuntimeError} \]

[In]

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negative exponent.

Giac [A] (verification not implemented)

none

Time = 0.36 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.18 \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {\frac {{\left (A - i \, B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a} - \frac {{\left (A + 3 i \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a} + \frac {A \tan \left (d x + c\right ) + 3 i \, B \tan \left (d x + c\right ) + i \, A + B}{a {\left (\tan \left (d x + c\right ) - i\right )}}}{4 \, d} \]

[In]

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="giac")

[Out]

1/4*((A - I*B)*log(tan(d*x + c) + I)/a - (A + 3*I*B)*log(tan(d*x + c) - I)/a + (A*tan(d*x + c) + 3*I*B*tan(d*x
 + c) + I*A + B)/(a*(tan(d*x + c) - I)))/d

Mupad [B] (verification not implemented)

Time = 7.83 (sec) , antiderivative size = 81, normalized size of antiderivative = 1.21 \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=-\frac {\frac {A}{2\,a}+\frac {B\,1{}\mathrm {i}}{2\,a}}{d\,\left (1+\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )}{4\,a\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (A+B\,3{}\mathrm {i}\right )}{4\,a\,d} \]

[In]

int((tan(c + d*x)*(A + B*tan(c + d*x)))/(a + a*tan(c + d*x)*1i),x)

[Out]

(log(tan(c + d*x) + 1i)*(A - B*1i))/(4*a*d) - (A/(2*a) + (B*1i)/(2*a))/(d*(tan(c + d*x)*1i + 1)) - (log(tan(c
+ d*x) - 1i)*(A + B*3i))/(4*a*d)